import request from '@/utils/request'

// 查询列表
export function fetchBrandList() {
  return request({
    url: '/admin/brands',
    method: 'get'
  })
}

// 查询单条
export function fetchBrand(id) {
  return request({
    url: `/admin/brands/${id}`,
    method: 'get'
  })
}

// 创建
export function createBrand(data) {
  return request({
    url: '/admin/brands',
    method: 'post',
    data
  })
}

// 修改
export function updateBrand(id, data) {
  return request({
    url: `/admin/brands/${id}`,
    method: 'put',
    data
  })
}

// 删除
export function deleteBrand(id) {
  return request({
    url: `/admin/brands/${id}`,
    method: 'delete'
  })
}

// 是否启用
export function ChangeEnableBrand(id, data) {
  return request({
    url: `/admin/brands/${id}/change_enable`,
    method: 'patch',
    data
  })
}
